package com.mibotiquin.config;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.actionbarsherlock.view.MenuItem;
import com.mibotiquin.R;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;

public class Configuracion extends SherlockPreferenceActivity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		ActionBar ab = getSupportActionBar();
        ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE|ActionBar.DISPLAY_SHOW_HOME|ActionBar.DISPLAY_HOME_AS_UP);
        ab.setTitle("MiBotiquin");
		setTheme(R.style.Letra);
		super.onCreate(savedInstanceState);
		
		// This static call will reset default values only on the first ever read
        PreferenceManager.setDefaultValues(getBaseContext(), R.layout.prefs, false);
		
		addPreferencesFromResource(R.layout.prefs);
		//findViewById(android.R.id.list).setBackgroundColor(Color.WHITE);
		
	
	Preference preference = findPreference("test_pref");
	preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
		@Override
		public boolean onPreferenceClick(Preference preference) {
			Intent intent = new Intent(getApplicationContext(), PerfilesActivity.class);
			startActivity(intent);
			return true;
		}
	});
}
	 public boolean onOptionsItemSelected(MenuItem item) {
	    	if(item.getItemId()==android.R.id.home) {
	    			finish();
	    			return true;
	    		
	    		} else return super.onOptionsItemSelected(item);	
	    	}
}
